<?php 
namespace app\index\controller;
use app\index\controller\Common;
use think\Db;

class Company extends Common{
    
    public function index(){
        $ind_sub = Db::name('nav')->where('sid', 2)->select();
        $banner = Db::name('banner')->where('is_show', 1)->field('img_url,link_url')->limit(1)->find();
        $banner = empty($banner) ? null : $banner;

        $nav_sub = Db::name('nav')->field('ename,nname')->where('sid', 2)->select();

        $rs = Db::name('company')->field('title,entitle,img_url,content')->where('nid', 8)->limit(1)->find();
        $wh = Db::name('company')->field('img_tit,content,img_url')->where('nid', 9)->limit(4)->select();
        $hj = Db::name('company')->field('img_tit,img_url')->where('nid', 10)->limit(4)->select();

        $company = [
            'sub' => $ind_sub,
            'banner' => $banner,
            'wh' => $wh,
            'nav_sub' => $nav_sub,
            'rs' => $rs,
            'hj' => $hj,
        ];
        $this->assign('company', $company);
        return $this->fetch('company');
    }
}